aboutsummaryrefslogtreecommitdiffstats
path: root/src/app/groups/[groupId]/expenses/expense-list.tsx
diff options
context:
space:
mode:
authorSebastien Castiel <sebastien@castiel.me>2024-01-09 08:53:51 -0500
committerSebastien Castiel <sebastien@castiel.me>2024-01-09 08:53:51 -0500
commit1b9e624004cfb64135b744f877e5fa87e5810abd (patch)
treef1994b7c10d98410bdc73ca323d2c32e6e019bac /src/app/groups/[groupId]/expenses/expense-list.tsx
parent6bd3299331265ea2a0c800e3c3199ad4e32ce8de (diff)
Ask the user who they are when opening a group for the first time (#7)
Diffstat (limited to 'src/app/groups/[groupId]/expenses/expense-list.tsx')
-rw-r--r--src/app/groups/[groupId]/expenses/expense-list.tsx14
1 files changed, 9 insertions, 5 deletions
diff --git a/src/app/groups/[groupId]/expenses/expense-list.tsx b/src/app/groups/[groupId]/expenses/expense-list.tsx
index ef4903c..4578300 100644
--- a/src/app/groups/[groupId]/expenses/expense-list.tsx
+++ b/src/app/groups/[groupId]/expenses/expense-list.tsx
@@ -27,11 +27,15 @@ export function ExpenseList({
if (activeUser || newUser) {
localStorage.removeItem('newGroup-activeUser')
localStorage.removeItem(`${groupId}-newUser`)
- const userId = participants.find(
- (p) => p.name === (activeUser || newUser),
- )?.id
- if (userId) {
- localStorage.setItem(`${groupId}-activeUser`, userId)
+ if (activeUser === 'None') {
+ localStorage.setItem(`${groupId}-activeUser`, 'None')
+ } else {
+ const userId = participants.find(
+ (p) => p.name === (activeUser || newUser),
+ )?.id
+ if (userId) {
+ localStorage.setItem(`${groupId}-activeUser`, userId)
+ }
}
}
}, [groupId, participants])